﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="renewal-notice-list.aspx.cs" Inherits="carinsurance_renewal_renewal_notice_list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Renewal Notice List</title>
    <%--<script src="../../js/tabs/jquery-1.9.1.js" type="text/javascript"></script>
    <link rel="Stylesheet" type="text/css" href="../../css/main.css" />--%>
    <%--<script type="text/javascript">
        $(document).ready(function() {
            $.ajax({
                    type: "POST",
                    url: "renewal-notice-list.aspx/callFunction",
                    data: '{CustomerID: ' + '0' + ', CarId: ' + '0' + ', AgentId: ' + '0' + ',RefNo: ' + '0' + '}',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: OnSuccess2,
                    failure: function(response) {
                        alert(response.d);
                    },
                    error: function(response) {
                        alert(response.d);
                    }
                });
         });
        
        function OnSuccess2(response) { alert('') }
    </script>--%>
</head>
<body>
    <form id="form1" runat="server" method="post" target="result">
    <div>
        <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
        <asp:GridView ID="grvApplication" runat="server" AllowPaging="false" AutoGenerateColumns="False"
                CssClass="sTable" GridLines="None" Width="100%" EmptyDataText="<%$Resources:General,ErrNodata%>"
                OnRowDataBound="grvApplication_RowDataBound" DataKeyNames="CECarId, RefCEUserID, ProviderCompanyID, QuoteRefNo">
                <Columns>
                    <asp:BoundField DataField="QuoteRefNo" HeaderText="<%$Resources:CarInsurance,ReferenceNo%>"
                        SortExpression="QuoteRefNo" ItemStyle-Width="70px" />
                    <asp:BoundField DataField="Name" HeaderText="<%$Resources:CarInsurance,Name%>" SortExpression="Name"
                        ItemStyle-Width="120px" />
                    <asp:BoundField DataField="CarLicense" HeaderText="<%$Resources:Proposal,PlateNumber%>"
                        SortExpression="CarLicense" ItemStyle-Width="80px" />
                    <asp:BoundField DataField="CoverageStart" HeaderText="<%$Resources:General,DateTime%>"
                        SortExpression="CoverageStart" ItemStyle-Width="100px" DataFormatString="{0:dd/MM/yyyy}" />
                    <asp:TemplateField ItemStyle-Width="200px" HeaderText="<%$Resources:General,Comments%>">
                    <ItemTemplate>
                        <asp:Literal runat="server" ID="lblCallStatusDesc" />
                        <div style="background-color: #ffffcc;"><strong><%#Eval("Remark")%></strong></div>
                    </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="RefCEUserId"
                        SortExpression="RefCEUserId" ><HeaderStyle CssClass="hiddencol" /><ItemStyle CssClass="hiddencol" /></asp:BoundField>
                    <asp:BoundField DataField="CECarId" 
                        SortExpression="CECarId" ><HeaderStyle CssClass="hiddencol" /><ItemStyle CssClass="hiddencol" /></asp:BoundField>
                    <asp:BoundField DataField="NewRefNo" HeaderText="<%$Resources:CarInsurance,NewReferenceNo%>"
                        SortExpression="NewRefNo" ItemStyle-Width="70px"></asp:BoundField>
                    <asp:BoundField DataField="CallFinishType" Visible="false" SortExpression="CallFinishType" />
                    <asp:TemplateField ItemStyle-Width="30px">
                    <ItemTemplate>
                        <asp:HyperLink runat="server" ID="linkPdf" onclick="return CheckLinkExist(this);" Target="_blank"></asp:HyperLink>
                    </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="50px">
                    <ItemTemplate>
                        <asp:HyperLink runat="server" ID="linkCallNow" Target="_blank" Text="<%$Resources:General,CallNow%>"></asp:HyperLink>
                    </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <FooterStyle />
                <PagerStyle />
                <SelectedRowStyle BackColor="ActiveBorder" />
                <HeaderStyle />
                <EditRowStyle />
                <AlternatingRowStyle />
                <RowStyle />
            </asp:GridView><hr style="width:100%" />
            <b><asp:Label ID="lblTotal" runat="server" Text="Renewal Total :"></asp:Label></b>&nbsp;&nbsp;<b><asp:Label ID="lblRenewTotal" runat="server"></asp:Label></b><asp:HiddenField runat="server" ID="hidAgentId" />
    </div>
    </form>
     <script type="text/javascript">
        function CheckLinkExist(obj) {
            var IsExist = false;
            var http = new XMLHttpRequest();
            http.open('HEAD', obj.href, false);
            http.send();

            if (http.status != 404) {
                IsExist = true;
            }
            else {
                alert("No file found!");
            }
            return IsExist;
        }

//        function CheckRenewalLead(obj) {
//            var fulllink = obj.href;
//            var qstring = fulllink.split('?');
//            if (qstring.length = 2) {
//                var custId = "";
//                var agentId = "";
//                var carId = "";
//                var refno = "";
//                var vals = qstring[1].split('&');
//                for (i = 0; i < vals.length; i++) {
//                    var svals = vals[i].split('=');
//                    if (i == 0) {
//                        custId = svals[1]
//                    }
//                    if (i == 1) {
//                        carId = svals[1]
//                    }
//                    if (i == 2) {
//                        agentId = svals[1]
//                    }   
//                    if (i == 3) {
//                        refno = svals[1]
//                    }
//                }
                
//                $.ajax({
//                    type: "POST",
//                    url: "renewal-notice-list.aspx/callFunction",
//                    data: '{CustomerID: ' + custId + ', CarId: ' + carId + ', AgentId: ' + agentId + ',RefNo: ' + refno + '}',
//                    contentType: "application/json; charset=utf-8",
//                    dataType: "json",
//                    success: OnSuccess,
//                    failure: function(response) {
//                        alert(response.d);
//                    },
//                    error: function(response) {
//                        alert(response.d);
//                    }
//                });
//            }
//        }

//        function OnSuccess(response) {
//            if (response.d != "error") {
//                var qstring = response.d.split(',');
//                alert(qstring);
//                window.open("/offline/ViewCINoMatchFound.aspx?leadid=" + qstring[0] + "&calltype=100&renew=2&custid=" + qstring[1] + "&carid=" + qstring[2] + "&refno=" + qstring[3], 
//                null,"height=200, width=400, status=yes, toolbar=no, menubar=no, location=no");
//            }
//        }
        
    </script>
</body>
</html>
